function result = my_conv(img, kernel)

p1 = im2double(img);
[m,n] = size(p1);
[row,col] = size(kernel);
result = zeros(m-row+1,n-col+1);

for i=((row-1)/2+1):(m-(row-1)/2)
    for j=((col-1)/2+1):(n-(col-1)/2)

        sum = 0;
        for k=-(row-1)/2:(row-1)/2
            for l=-(col-1)/2:(col-1)/2
                 sum = sum + kernel(k+(row-1),l+(col-1)) * p1(i+k,j+l);
            end
        end
        result(i-(row-1)/2,j-(col-1)/2) = sum;

    end
end

end